# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.db import models
from main.models import Employee

class TrainingsRSIS(models.Model):
    kind = models.CharField(max_length=150, verbose_name=u"Разновидность тренинга")
    title = models.CharField(max_length=250, verbose_name=u"Название тренинга")
    note = models.TextField(verbose_name=u"Примечание")
    employees = models.ManyToManyField(Employee, verbose_name=u"Сотрудники")
    date = models.DateField(auto_now=True, verbose_name=u"Дата")

    def get_absolute_url(self):
        return reverse('trainings_detail', args=[u'rsis',self.pk])

    class Meta:
        verbose_name=u'Тренинг РСИС'
        verbose_name_plural = u'Тренинги РСИС'
        permissions = (
            ("can_view_trainingsrsis", u"Может смотреть Обучения"),
        )

    def __unicode__(self):
        return u'%s' % self.title

class TrainingsWORK(models.Model):
    kind = models.CharField(max_length=150, verbose_name=u"Разновидность тренинга", blank=True)
    title = models.CharField(max_length=250, verbose_name=u"Название тренинга", blank=True)
    direction = models.CharField(max_length=150, blank=True, null=True, verbose_name=u"Направление повышения квалификации")
    note = models.TextField(verbose_name=u"Примечание", blank=True)
    employees = models.ManyToManyField(Employee, verbose_name=u"Сотрудники")
    date = models.DateField(auto_now=True, verbose_name=u"Дата")

    def get_absolute_url(self):
        return reverse('trainings_detail', args=[u'workers', self.pk])

    class Meta:
        verbose_name=u'Тренинг Рабочих'
        verbose_name_plural = u'Тренинги Рабочих'
        permissions = (
            ("can_view_trainingswork", u"Может смотреть Обучения"),
        )

    def __unicode__(self):
        return u'%s' % self.title
